import { Component, OnInit, ViewChild } from '@angular/core';
import { ToolService } from 'src/app/service/tool.service';
import { HttpService } from 'src/app/service/http.service';
import { UrlService } from 'src/app/service/url.service';
import { ConfigService } from 'src/app/service/config.service';
import { PopwinService } from 'src/app/service/popwin.service';
import { NavController, IonInfiniteScroll, IonRefresher, PickerController } from '@ionic/angular';
import { EventService } from 'src/app/service/event.service';
import { Storage } from '@ionic/storage';
import { Router } from '@angular/router';
import * as $ from 'jquery';

@Component({
  selector: 'app-index',
  templateUrl: './index.page.html',
  styleUrls: ['./index.page.scss'],
})
export class IndexPage implements OnInit {
  startData: string = ToolService.getNowFormatDate();
  endData: string = ToolService.getNowFormatDate();
  public dealDate = "";//处理后的日期格式 2019-05-20为190520
  list = [];
  sum = { "cnt": 0, "cash": 0, "result": 0 };
  minValue = "2019-01-01";
  typeData = { "unsettlement": true, "report": false, "settlement": false };
  public openList: any[] = [];//未结的数据
  public closedList: any[] = [];//今日已结
  private pageNum = 0;  //页码
  public showBack: boolean = false;  //未结明细是否显示返回到彩票详细页面中

  //第三方游戏
  public gameName = [];//第三方的游戏的名称
  public selectName = "全部";
  public selectPlatformID = "all";
  public thirdList = [];//查询出第三方的报表数据信息
  public thirdListSum = { "cnt": "0", "cash": "0.00", "result": "0.00" }; //AG的报表数据汇总
  public thirdSBOList = [];//查询出第三方的SBO的报表信息
  public thirdSBOListSum = { "cnt": "0", "cash": "0.00", "result": "0.00" }; //SBO的报表数据汇总
  public thirdKYList = [];//开元棋牌报表的列表信息
  public thirdKYListSum = { "cnt": "0", "cash": "0.00", "result": "0.00" }; //开元的报表数据汇总
  public thirdSWList = [];//双赢棋牌报表的列表信息
  public thirdSWListSum = { "cnt": "0", "cash": "0.00", "result": "0.00" }; //双赢的报表数据汇总
  public thirdSGList = [];//开元彩票报表的列表信息
  public thirdSGListSum = { "cnt": "0", "cash": "0.00", "result": "0.00" }; //开元彩票的报表数据汇总
  public allReportList = [];//彩票和所有第三方的数据列表
  public allReportListSum = { "cnt": "0", "cash": "0.00", "result": "0.00" }; //AG的报表数据汇总
  public thirdPSList = [];//平博体育报表的列表信息
  public thirdPSListSum = { "cnt": "0", "cash": "0.00", "result": "0.00" }; //平博体育的报表数据汇总

  public isThird = false;

  @ViewChild(IonInfiniteScroll) infiniteScroll: IonInfiniteScroll;
  @ViewChild(IonRefresher) ionRefresher: IonRefresher;
  constructor(private http: HttpService, private popWin: PopwinService, private navCtrl: NavController, private eventS: EventService, private store: Storage,
    private router: Router, private pickercontroller: PickerController) {
    this.isThird = ConfigService.is3rd;
  }

  ngOnInit() {
    this.initEvent();//事件的监听
    this.dealDate = this.startData.substr(2).replace(/-/g, '');
    this.isShowBack();
    if (this.isThird) {
      this.getSelectOption();
    }
  }
  /**
   * 未结明细中是否显示返回的按钮
   */
  isShowBack() {
    if (!ToolService.isEmpty($("app-root").attr("code")) && !ToolService.isEmpty($("app-root").attr("name"))) {
      this.showBack = true;
    } else {
      this.showBack = false;
    }
  }
  /**
   * 未结明显中返回按钮跳转到盘口的页面中
   */
  backLotter() {
    if (!ToolService.isEmpty($("app-root").attr("code")) && !ToolService.isEmpty($("app-root").attr("name"))) {
      let param = "{\"code\":\"" + $("app-root").attr("code") + "\",\"name\":\"" + $("app-root").attr("name") + "\",\"lotteryId\":\"" + $("app-root").attr("lotteryId") + "\"}";
      this.router.navigate(['/lotdetail'], {
        queryParams: { "p": ToolService.paramAESEncrypt(param) },
        skipLocationChange: true
      });
    }
  }
  isLogin() {
    //未登录进行登录
    this.store.get(ConfigService.IS_LOGIN_STORE_KEY).then((data) => {
      if (ToolService.isEmpty(data)) {
        this.navCtrl.navigateForward("/login");
        return;
      }
    });
  }

  initEvent() {
    let that = this;
    this.eventS.subscribe("selectCommonTab5", function (index) {
      if (index == 5) {
        that.toUnSettlement();
        that.isShowBack();
        // that.reportNet(that.startData.substr(0, 10), that.endData.substr(0, 10));
      }
    }, true);
  }

  toSettlement() {//显示今日已结
    this.typeData = { "unsettlement": false, "report": false, "settlement": true };
    this.pageNum = 0;
    this.lementNet(1);
  }

  toReport() {//显示报表查询
    this.typeData = { "unsettlement": false, "report": true, "settlement": false };
    this.sum = { "cnt": 0, "cash": 0, "result": 0 };
  }
  toUnSettlement() {//显示未结算
    this.typeData = { "unsettlement": true, "report": false, "settlement": false };
    this.pageNum = 0;
    this.lementNet(0);
  }


  lementNet(is_hit, isMore?: boolean) {
    let that = this;
    let obj = "{\"is_hit\":\"" + is_hit + "\",\"page\":\"" + this.pageNum + "\",\"pageSize\":\"20\"}";
    console.log(obj);
    this.http.get(UrlService.LOTSGAM_ORDERDETAIL, { "callback": "JSONP_CALLBACK", "data": ToolService.aesEncode(obj) }).subscribe(res => {
      let data = res.json();
      ToolService.setEncrypt(data.encrypt);
      that.ionRefresher.complete();
      that.infiniteScroll.complete();
      if (data.code == ConfigService.SUCCESS_CODE) {
        let temp = data.data;
        let tt = ToolService.aesDecodeToJson(temp);
        if (isMore) {//上拉更多
          console.log("加载更多");
          if (is_hit == "0") {
            that.openList = that.openList.concat(tt.list);
          } else if (is_hit == "1") {
            that.closedList = that.closedList.concat(tt.list);
          }
          if (tt.list.length < 20) {
            that.infiniteScroll.disabled = true;
            return;
          }
        } else {//第一次进入
          console.log("第一次进入...");
          if (is_hit == "0") {
            that.openList = tt.list;
          } else if (is_hit == "1") {
            that.closedList = tt.list;
          }
          if (tt.list.length < 20) {
            that.infiniteScroll.disabled = true;
          } else {
            that.infiniteScroll.disabled = false;
          }
        }
        that.sum = tt.sum;
        console.log(tt);
        //  console.log(tt);
      } else if (data.code == ConfigService.FAIL_CODE) {
        that.popWin.toast(data.message);
      } else if (data.code == ConfigService.LOGIN_CODE) {
        that.navCtrl.navigateForward("/login");
      }
    }, error => {
      console.log("error", error);
      that.ionRefresher.complete();
      that.infiniteScroll.complete();
    });
  }

  doRefresh(event, type) {
    this.pageNum = 0;
    this.lementNet(type);
  }

  loadMoreData(event, type) {
    this.pageNum++;
    this.lementNet(type, true);
  }

  fourteenDay(timeData, day) {
    let dateTime = new Date(timeData);
    let tempTime = dateTime.setDate(dateTime.getDate() - day);
    dateTime = new Date(tempTime);
    return dateTime;
  }

  onSearch() {
    this.isLogin();
    let res = ToolService.compareGTDate(this.startData.substr(0, 10), this.fourteenDay(this.endData.substr(0, 10), 14));
    if(!res){
      this.popWin.toast("只能查询进14天的数据");
      return
    }
    if (this.selectPlatformID == '-1') {//彩票的报表查询
      let comRes = ToolService.compareDate(this.startData.substr(0, 10), this.endData.substr(0, 10));
      if (comRes) {
        this.popWin.toast("开始时间应该小于结束时间");
        return;
      }
      this.reportNet(this.startData.substr(0, 10), this.endData.substr(0, 10));
    } else if (this.selectPlatformID == 'sbo') {
      this.report3rdSBONet();
    } else if (this.selectPlatformID == 'ky') {
      this.report3rdKYNet();
    } else if (this.selectPlatformID == 'all') {
      this.reportAllNet();
    } else if (this.selectPlatformID == 'sg') { //双赢彩票
      this.report3rdSGNet();
    } else if (this.selectPlatformID == 'sw') { //双赢棋牌
      this.report3rdSWNet();
    } else if (this.selectPlatformID == 'ps') { //平博体育
      this.report3rdPSNet();
    } else { //AG
      this.report3rdNet();
    }
  }

  reportNet(startTime, endTime) {
    let that = this;
    let obj = "{\"sdate\":\"" + startTime + "\",\"edate\":\"" + endTime + "\"}";
    this.http.get(UrlService.USER_ORDERHIST, { "callback": "JSONP_CALLBACK", "data": ToolService.aesEncode(obj) }).subscribe(res => {
      let data = res.json();
      ToolService.setEncrypt(data.encrypt);
      if (data.code == ConfigService.SUCCESS_CODE) {
        let res = ToolService.aesDecodeToJson(data.data);
        if (ToolService.isEmpty(res.list)) {
          that.popWin.toast("暂时没有查询到数据");
          return;
        }
        that.list = res.list;
        that.sum = res.sum;
        console.log("未结总额:", res.sum);
        console.log(res);
      } else {

      }
    }, error => {
      that.popWin.toast(ToolService.newError(error));
    });

  }
  /**
   * 跳转到相信数据的页面
   */
  toReportlist(date) {
    let param = "{\"sdate\":\"" + date + "\"}";
    this.router.navigate(['/reportlist'], {
      queryParams: { "p": ToolService.paramAESEncrypt(param) }
    });
  }
  /////第三方游戏的处理
  /**
   * 获取游戏平台的名称
   */
  getSelectOption() {
    let that = this;
    this.http.get(UrlService.THIRD_GETPLATFORMNAMES, { "callback": "JSONP_CALLBACK" }).subscribe(res => {
      let data = res.json();
      ToolService.setEncrypt(data.encrypt);
      if (data.code == ConfigService.SUCCESS_CODE) {
        let res = ToolService.aesDecodeToJson(data.data);
        if (!ToolService.isEmpty(res) && res.length >= 1) {
          let tempPlatformArr = [{ "id": "all", "platform_name": "全部" }, { "id": "-1", "platform_name": "万漉国际" }];
          that.gameName = tempPlatformArr.concat(res);
        }
        console.log("拼接后获取游戏平台的名称--", that.gameName);
      } else if (data.code == ConfigService.FAIL_CODE) {
        that.popWin.toast(data.message);
      } else if (data.code == ConfigService.LOGIN_CODE) {
        that.navCtrl.navigateForward("/login");
      }
    }, error => {
      console.log("error", error);
    });
  }
  /**
   * picker选择器
   * @param type 类型是第一个选项还是第二个选择
   * @param numColumns 默认是1列
   */

  async  openPicker(numColumns = 1) {
    let that = this;
    let data = this.gameName;
    if (data.length <= 1) {
      return;
    }
    let numOptions = data.length;
    let multiColumnOptions = [];
    let arr = [];
    for (let tempItem in data) {
      arr.push(data[tempItem].platform_name);
    }
    multiColumnOptions.push(arr);
    const picker = await this.pickercontroller.create({
      columns: this.getColumns(numColumns, numOptions, multiColumnOptions),
      buttons: [
        {
          text: '取消',
          role: 'cancel'
        },
        {
          text: '确认',
          handler: (value) => {
            that.selectName = value['col-0'].text;
            that.selectPlatformID = data[value['col-0'].value].id + "";
            console.log("选中的名字:" + that.selectName + "-选中的platformID-" + that.selectPlatformID);
          }
        }
      ]
    });
    await picker.present();
  }

  getColumns(numColumns, numOptions, columnOptions) {
    let columns = [];
    for (let i = 0; i < numColumns; i++) {
      columns.push({
        name: `col-${i}`,
        options: this.getColumnOptions(i, numOptions, columnOptions)
      });
    }
    return columns;
  }

  getColumnOptions(columnIndex, numOptions, columnOptions) {
    let options = [];
    for (let i = 0; i < numOptions; i++) {
      options.push({
        text: columnOptions[columnIndex][i % numOptions],
        value: i
      })
    }
    return options;
  }
  /**
   * 第三方游戏的报表列表数据
   */
  report3rdNet() {
    if (this.selectPlatformID == '-1') {
      return;
    }
    let that = this;
    let obj = "{\"platformId\":\"" + this.selectPlatformID + "\",\"sdate\":\"" + this.startData.substr(0, 10) + "\",\"edate\":\"" + this.endData.substr(0, 10) + "\"}";
    this.http.get(UrlService.THIRD_REPORTLIST, { "callback": "JSONP_CALLBACK", "data": ToolService.aesEncode(obj) }).subscribe(res => {
      let data = res.json();
      ToolService.setEncrypt(data.encrypt);
      if (data.code == ConfigService.SUCCESS_CODE) {
        let res = ToolService.aesDecodeToJson(data.data);
        if (!ToolService.isEmpty(res.list) && res.list.length > 0) {
          that.thirdList = res.list;
          that.thirdListSum = res.sum;
        } else {
          that.thirdList = [];
          that.thirdListSum = { "cnt": "0", "cash": "0.00", "result": "0.00" };
          that.popWin.toast("暂时没有查询到数据");
        }
        console.log("第三方的报表的列表的数据--", res);
      } else if (data.code == ConfigService.FAIL_CODE) {
        that.popWin.toast(data.message);
      } else if (data.code == ConfigService.LOGIN_CODE) {
        that.navCtrl.navigateForward("/login");
      }
    }, error => {
      console.log("error", error);
    });
  }
  /**
   * 查看第三方的详细数据
   * @param item 选择行的数据
   */
  toReportThirdlist(item) {
    if (ConfigService.is3rd) {
      let param = "{\"sdate\":\"" + item.report_date + "\",\"pid\":\"" + this.selectPlatformID + "\",\"t\":\"" + true + "\"}";
      this.router.navigate(['/reportlist'], {
        queryParams: { "p": ToolService.paramAESEncrypt(param) }
      });
    } else {
      this.popWin.toast("非法进入请重试");
    }

  }

  /**
   * 第三方游戏的报表列表数据
   */
  report3rdSBONet() {
    if (this.selectPlatformID !== 'sbo') {
      return;
    }
    let that = this;
    let obj = "{\"sdate\":\"" + this.startData.substr(0, 10) + "\",\"edate\":\"" + this.endData.substr(0, 10) + "\"}";
    this.http.get(UrlService.THIRD_SBOREPORTLIST, { "callback": "JSONP_CALLBACK", "data": ToolService.aesEncode(obj) }).subscribe(res => {
      let data = res.json();
      ToolService.setEncrypt(data.encrypt);
      if (data.code == ConfigService.SUCCESS_CODE) {
        let res = ToolService.aesDecodeToJson(data.data);
        if (!ToolService.isEmpty(res.list) && res.list.length > 0) {
          that.thirdSBOList = res.list;
          that.thirdSBOListSum = res.sum;
        } else {
          that.thirdSBOList = [];
          that.thirdSBOListSum = { "cnt": "0", "cash": "0.00", "result": "0.00" };
          that.popWin.toast("暂时没有查询到数据");
        }
        console.log("第三方的报表的列表的数据--", res);
      } else if (data.code == ConfigService.FAIL_CODE) {
        that.popWin.toast(data.message);
      } else if (data.code == ConfigService.LOGIN_CODE) {
        that.navCtrl.navigateForward("/login");
      }
    }, error => {
      console.log("error", error);
    });
  }

  /**
   * 查看第三方的详细数据
   * @param item 选择行的数据
   */
  toReportThirdSBOlist(item) {
    if (ConfigService.is3rd) {
      let param = "{\"sdate\":\"" + item.report_date + "\",\"pid\":\"" + this.selectPlatformID + "\",\"t\":\"" + true + "\"}";
      this.router.navigate(['/reportlist'], {
        queryParams: { "p": ToolService.paramAESEncrypt(param) }
      });
    } else {
      this.popWin.toast("非法进入请重试");
    }
  }

  /**
  * 第三方游戏的报表列表数据
  */
  report3rdKYNet() {
    if (this.selectPlatformID !== 'ky') {
      return;
    }
    let that = this;
    let obj = "{\"sdate\":\"" + this.startData.substr(0, 10) + "\",\"edate\":\"" + this.endData.substr(0, 10) + "\"}";
    this.http.get(UrlService.THIRD_KYGAME_REPORTLIST, { "callback": "JSONP_CALLBACK", "data": ToolService.aesEncode(obj) }).subscribe(res => {
      let data = res.json();
      ToolService.setEncrypt(data.encrypt);
      if (data.code == ConfigService.SUCCESS_CODE) {
        let res = ToolService.aesDecodeToJson(data.data);
        if (!ToolService.isEmpty(res.list) && res.list.length > 0) {
          that.thirdKYList = res.list;
          that.thirdKYListSum = res.sum;
        } else {
          that.thirdKYList = [];
          that.thirdKYListSum = { "cnt": "0", "cash": "0.00", "result": "0.00" };
          that.popWin.toast("暂时没有查询到数据");
        }
        console.log("第三方开元报表的列表的数据--", res);
      } else if (data.code == ConfigService.FAIL_CODE) {
        that.popWin.toast(data.message);
      } else if (data.code == ConfigService.LOGIN_CODE) {
        that.navCtrl.navigateForward("/login");
      }
    }, error => {
      console.log("error", error);
    });
  }

  report3rdSWNet() { //双赢棋牌
    if (this.selectPlatformID !== 'sw') {
      return;
    }
    let that = this;
    let obj = "{\"sdate\":\"" + this.startData.substr(0, 10) + "\",\"edate\":\"" + this.endData.substr(0, 10) + "\"}";
    this.http.get(UrlService.THIRD_SWGAME_REPORTLIST, { "callback": "JSONP_CALLBACK", "data": ToolService.aesEncode(obj) }).subscribe(res => {
      let data = res.json();
      ToolService.setEncrypt(data.encrypt);
      if (data.code == ConfigService.SUCCESS_CODE) {
        let res = ToolService.aesDecodeToJson(data.data);
        if (!ToolService.isEmpty(res.list) && res.list.length > 0) {
          that.thirdSWList = res.list;
          that.thirdSWListSum = res.sum;
        } else {
          that.thirdSWList = [];
          that.thirdSWListSum = { "cnt": "0", "cash": "0.00", "result": "0.00" };
          that.popWin.toast("暂时没有查询到数据");
        }
        console.log("第三方双赢棋牌报表的列表的数据--", res);
      } else if (data.code == ConfigService.FAIL_CODE) {
        that.popWin.toast(data.message);
      } else if (data.code == ConfigService.LOGIN_CODE) {
        that.navCtrl.navigateForward("/login");
      }
    }, error => {
      console.log("error", error);
    });
  }

  report3rdPSNet() { //平博体育
    if (this.selectPlatformID !== 'ps') {
      return;
    }
    let that = this;
    let obj = "{\"sdate\":\"" + this.startData.substr(0, 10) + "\",\"edate\":\"" + this.endData.substr(0, 10) + "\"}";
    this.http.get(UrlService.THIRD_PS_SBOREPORTLIST, { "callback": "JSONP_CALLBACK", "data": ToolService.aesEncode(obj) }).subscribe(res => {
      let data = res.json();
      ToolService.setEncrypt(data.encrypt);
      if (data.code == ConfigService.SUCCESS_CODE) {
        let res = ToolService.aesDecodeToJson(data.data);
        if (!ToolService.isEmpty(res.list) && res.list.length > 0) {
          that.thirdPSList = res.list;
          that.thirdPSListSum = res.sum;
        } else {
          that.thirdPSList = [];
          that.thirdPSListSum = { "cnt": "0", "cash": "0.00", "result": "0.00" };
          that.popWin.toast("暂时没有查询到数据");
        }
        console.log("第三方平博体育报表的列表的数据--", res);
      } else if (data.code == ConfigService.FAIL_CODE) {
        that.popWin.toast(data.message);
      } else if (data.code == ConfigService.LOGIN_CODE) {
        that.navCtrl.navigateForward("/login");
      }
    }, error => {
      console.log("error", error);
    });
  }

  report3rdSGNet() {
    if (this.selectPlatformID !== 'sg') {
      return;
    }
    let that = this;
    let obj = "{\"sdate\":\"" + this.startData.substr(0, 10) + "\",\"edate\":\"" + this.endData.substr(0, 10) + "\"}";
    this.http.get(UrlService.THIRD_SGREPORTLIST, { "callback": "JSONP_CALLBACK", "data": ToolService.aesEncode(obj) }).subscribe(res => {
      let data = res.json();
      ToolService.setEncrypt(data.encrypt);
      if (data.code == ConfigService.SUCCESS_CODE) {
        let res = ToolService.aesDecodeToJson(data.data);
        if (!ToolService.isEmpty(res.list) && res.list.length > 0) {
          that.thirdSGList = res.list;
          that.thirdSGListSum = res.sum;
        } else {
          that.thirdSGList = [];
          that.thirdSGListSum = { "cnt": "0", "cash": "0.00", "result": "0.00" };
          that.popWin.toast("暂时没有查询到数据");
        }
        console.log("第三方开元报表的列表的数据--", res);
      } else if (data.code == ConfigService.FAIL_CODE) {
        that.popWin.toast(data.message);
      } else if (data.code == ConfigService.LOGIN_CODE) {
        that.navCtrl.navigateForward("/login");
      }
    }, error => {
      console.log("error", error);
    });
  }

  reportAllNet() {
    if (this.selectPlatformID !== 'all') {
      return;
    }
    let that = this;
    let obj = "{\"sdate\":\"" + this.startData.substr(0, 10) + "\",\"edate\":\"" + this.endData.substr(0, 10) + "\"}";
    this.http.get(UrlService.REPORT_ALLREPORTLIST, { "callback": "JSONP_CALLBACK", "data": ToolService.aesEncode(obj) }).subscribe(res => {
      let data = res.json();
      ToolService.setEncrypt(data.encrypt);
      if (data.code == ConfigService.SUCCESS_CODE) {
        let res = ToolService.aesDecodeToJson(data.data);
        if (!ToolService.isEmpty(res.list) && res.list.length > 0) {
          that.allReportList = res.list;
          that.allReportListSum = res.sum;
        } else {
          that.allReportList = [];
          that.allReportListSum = { "cnt": "0", "cash": "0.00", "result": "0.00" };
          that.popWin.toast("暂时没有查询到数据");
        }
        console.log("所有报表的列表的数据--", res);
      } else if (data.code == ConfigService.FAIL_CODE) {
        that.popWin.toast(data.message);
      } else if (data.code == ConfigService.LOGIN_CODE) {
        that.navCtrl.navigateForward("/login");
      }
    }, error => {
      console.log("error", error);
    });
  }


  /**
   * 查看第三方的详细数据
   * @param item 选择行的数据
   */
  toReportThirdKYlist(item) {
    if (ConfigService.is3rd) {
      let param = "{\"sdate\":\"" + item.report_date + "\",\"pid\":\"" + this.selectPlatformID + "\",\"t\":\"" + true + "\"}";
      this.router.navigate(['/reportlist'], {
        queryParams: { "p": ToolService.paramAESEncrypt(param) }
      });
    } else {
      this.popWin.toast("非法进入请重试");
    }
  }

  toReportThirdSWlist(item) {
    if (ConfigService.is3rd) {
      let param = "{\"sdate\":\"" + item.report_date + "\",\"pid\":\"" + this.selectPlatformID + "\",\"t\":\"" + true + "\"}";
      this.router.navigate(['/reportlist'], {
        queryParams: { "p": ToolService.paramAESEncrypt(param) }
      });
    } else {
      this.popWin.toast("非法进入请重试");
    }
  }

  toReportThirdPSlist(item) {
    if (ConfigService.is3rd) {
      let param = "{\"sdate\":\"" + item.report_date + "\",\"pid\":\"" + this.selectPlatformID + "\",\"t\":\"" + true + "\"}";
      this.router.navigate(['/reportlist'], {
        queryParams: { "p": ToolService.paramAESEncrypt(param) }
      });
    } else {
      this.popWin.toast("非法进入请重试");
    }
  }

  toReportThirdSGlist(item) {
    if (ConfigService.is3rd) {
      let param = "{\"sdate\":\"" + item.report_date + "\",\"pid\":\"" + this.selectPlatformID + "\",\"t\":\"" + true + "\"}";
      this.router.navigate(['/reportlist'], {
        queryParams: { "p": ToolService.paramAESEncrypt(param) }
      });
    } else {
      this.popWin.toast("非法进入请重试");
    }
  }
  /**
   * 彩票和所有第三方游戏报表的详细跳转
   */
  toReportSeparatelist(item) {
    let typeVal = item.type + "";
    if (ConfigService.is3rd) {
      if (typeVal == '0') { //彩票
        this.toReportlist(item.date);
      } else if (typeVal == '1') { //AG
        this.toReportSeparatelistDetail(item.date, '1');
      } else if (typeVal == 'sbo') {  //利己SBO
        this.toReportSeparatelistDetail(item.date, 'sbo');
      } else if (typeVal == 'ky') {  //开元棋牌
        this.toReportSeparatelistDetail(item.date, 'ky');
      } else if(typeVal == 'sg'){ //双赢彩票
        this.toReportSeparatelistDetail(item.date, 'sg');
      }else if(typeVal == 'sw'){ //双赢棋牌
        this.toReportSeparatelistDetail(item.date, 'sw');
      }else if(typeVal == 'ps'){ //平博体育
        this.toReportSeparatelistDetail(item.date, 'ps');
      }
    } else {
      this.popWin.toast("非法进入请重试");
    }
  }
  /**
   * 从所有报表列表中跳转到具体的详细页面
   */
  toReportSeparatelistDetail(date, platformID) {
    let param = "{\"sdate\":\"" + date + "\",\"pid\":\"" + platformID + "\",\"t\":\"" + true + "\"}";
    this.router.navigate(['/reportlist'], {
      queryParams: { "p": ToolService.paramAESEncrypt(param) }
    });
  }
}
